//
//  CommentTableViewCell1.m
//  ybzj
//
//  Created by liyuan on 15/7/24.
//  Copyright (c) 2015年 liyuan. All rights reserved.
//

#import "CommentTableViewCell1.h"
#import "CommentEntity.h"

@interface CommentTableViewCell1 ()
@property (weak, nonatomic) IBOutlet UIView *Comment1;
@property (weak, nonatomic) IBOutlet UIView *Comment2;
@property (weak, nonatomic) IBOutlet UIView *Comment3;
@property (weak, nonatomic) IBOutlet UIView *Comment4;

@end

@implementation CommentTableViewCell1


- (void)awakeFromNib {
    // Initialization code
    CGFloat width=[UIScreen mainScreen].bounds.size.width;
    CommentEntity *entity1=[CommentEntity instanceTextView];
    self.Comment1.translatesAutoresizingMaskIntoConstraints=NO;
    NSLayoutConstraint *topConstrainforComment1=[NSLayoutConstraint constraintWithItem:self.Comment1
                                                                            attribute:NSLayoutAttributeTop
                                                                            relatedBy:NSLayoutRelationEqual
                                                                               toItem:self.contentView
                                                                            attribute:NSLayoutAttributeTop
                                                                           multiplier:1.0f
                                                                             constant:width*40/640];
    
    NSLayoutConstraint *leftConstrainforComment1=[NSLayoutConstraint constraintWithItem:self.Comment1
                                                                              attribute:NSLayoutAttributeLeading
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.contentView
                                                                              attribute:NSLayoutAttributeLeading
                                                                             multiplier:1.0f
                                                                               constant:width*216/640];
    
    NSLayoutConstraint *heightConstrainforComment1=[NSLayoutConstraint constraintWithItem:self.Comment1
                                                                                attribute:NSLayoutAttributeHeight
                                                                                relatedBy:NSLayoutRelationEqual
                                                                                   toItem:nil
                                                                                attribute:NSLayoutAttributeNotAnAttribute
                                                                               multiplier:1.0f
                                                                                 constant:width*26/640];
    
    NSLayoutConstraint *widthConstrainforComment1=[NSLayoutConstraint constraintWithItem:self.Comment1
                                                                                attribute:NSLayoutAttributeWidth
                                                                                relatedBy:NSLayoutRelationEqual
                                                                                   toItem:nil
                                                                                attribute:NSLayoutAttributeNotAnAttribute
                                                                               multiplier:1.0f
                                                                                 constant:width*400/640];
    
    topConstrainforComment1.active=YES;
    leftConstrainforComment1.active=YES;
    heightConstrainforComment1.active=YES;
    widthConstrainforComment1.active=YES;
    entity1.frame=self.Comment1.bounds;
    [self.Comment1 addSubview:entity1];
    [entity1 setTitle:@"服务态度"];
    [entity1 setScore:4.0];
    
    CommentEntity *entity2=[CommentEntity instanceTextView];
    self.Comment2.translatesAutoresizingMaskIntoConstraints=NO;
    NSLayoutConstraint *topConstrainforComment2=[NSLayoutConstraint constraintWithItem:self.Comment2
                                                                             attribute:NSLayoutAttributeTop
                                                                             relatedBy:NSLayoutRelationEqual
                                                                                toItem:self.contentView
                                                                             attribute:NSLayoutAttributeTop
                                                                            multiplier:1.0f
                                                                              constant:width*85/640];
    
    NSLayoutConstraint *leftConstrainforComment2=[NSLayoutConstraint constraintWithItem:self.Comment2
                                                                              attribute:NSLayoutAttributeLeading
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.contentView
                                                                              attribute:NSLayoutAttributeLeading
                                                                             multiplier:1.0f
                                                                               constant:width*216/640];
    
    NSLayoutConstraint *heightConstrainforComment2=[NSLayoutConstraint constraintWithItem:self.Comment2
                                                                                attribute:NSLayoutAttributeHeight
                                                                                relatedBy:NSLayoutRelationEqual
                                                                                   toItem:nil
                                                                                attribute:NSLayoutAttributeNotAnAttribute
                                                                               multiplier:1.0f
                                                                                 constant:width*26/640];
    
    NSLayoutConstraint *widthConstrainforComment2=[NSLayoutConstraint constraintWithItem:self.Comment2
                                                                               attribute:NSLayoutAttributeWidth
                                                                               relatedBy:NSLayoutRelationEqual
                                                                                  toItem:nil
                                                                               attribute:NSLayoutAttributeNotAnAttribute
                                                                              multiplier:1.0f
                                                                                constant:width*400/640];
    
    topConstrainforComment2.active=YES;
    leftConstrainforComment2.active=YES;
    heightConstrainforComment2.active=YES;
    widthConstrainforComment2.active=YES;
    entity2.frame=self.Comment2.bounds;
    [self.Comment2 addSubview:entity2];
    [entity2 setTitle:@"环境卫生"];
    [entity2 setScore:4.4];
    
    CommentEntity *entity3=[CommentEntity instanceTextView];
    self.Comment3.translatesAutoresizingMaskIntoConstraints=NO;
    NSLayoutConstraint *topConstrainforComment3=[NSLayoutConstraint constraintWithItem:self.Comment3
                                                                             attribute:NSLayoutAttributeTop
                                                                             relatedBy:NSLayoutRelationEqual
                                                                                toItem:self.contentView
                                                                             attribute:NSLayoutAttributeTop
                                                                            multiplier:1.0f
                                                                              constant:width*130/640];
    
    NSLayoutConstraint *leftConstrainforComment3=[NSLayoutConstraint constraintWithItem:self.Comment3
                                                                              attribute:NSLayoutAttributeLeading
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.contentView
                                                                              attribute:NSLayoutAttributeLeading
                                                                             multiplier:1.0f
                                                                               constant:width*216/640];
    
    NSLayoutConstraint *heightConstrainforComment3=[NSLayoutConstraint constraintWithItem:self.Comment3
                                                                                attribute:NSLayoutAttributeHeight
                                                                                relatedBy:NSLayoutRelationEqual
                                                                                   toItem:nil
                                                                                attribute:NSLayoutAttributeNotAnAttribute
                                                                               multiplier:1.0f
                                                                                 constant:width*26/640];
    
    NSLayoutConstraint *widthConstrainforComment3=[NSLayoutConstraint constraintWithItem:self.Comment3
                                                                               attribute:NSLayoutAttributeWidth
                                                                               relatedBy:NSLayoutRelationEqual
                                                                                  toItem:nil
                                                                               attribute:NSLayoutAttributeNotAnAttribute
                                                                              multiplier:1.0f
                                                                                constant:width*400/640];
    
    topConstrainforComment3.active=YES;
    leftConstrainforComment3.active=YES;
    heightConstrainforComment3.active=YES;
    widthConstrainforComment3.active=YES;
    entity3.frame=self.Comment3.bounds;
    [self.Comment3 addSubview:entity3];
    [entity3 setTitle:@"交通便利"];
    [entity3 setScore:5.0];
    
    CommentEntity *entity4=[CommentEntity instanceTextView];
    self.Comment4.translatesAutoresizingMaskIntoConstraints=NO;
    NSLayoutConstraint *topConstrainforComment4=[NSLayoutConstraint constraintWithItem:self.Comment4
                                                                             attribute:NSLayoutAttributeTop
                                                                             relatedBy:NSLayoutRelationEqual
                                                                                toItem:self.contentView
                                                                             attribute:NSLayoutAttributeTop
                                                                            multiplier:1.0f
                                                                              constant:width*175/640];
    
    NSLayoutConstraint *leftConstrainforComment4=[NSLayoutConstraint constraintWithItem:self.Comment4
                                                                              attribute:NSLayoutAttributeLeading
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.contentView
                                                                              attribute:NSLayoutAttributeLeading
                                                                             multiplier:1.0f
                                                                               constant:width*216/640];
    
    NSLayoutConstraint *heightConstrainforComment4=[NSLayoutConstraint constraintWithItem:self.Comment4
                                                                                attribute:NSLayoutAttributeHeight
                                                                                relatedBy:NSLayoutRelationEqual
                                                                                   toItem:nil
                                                                                attribute:NSLayoutAttributeNotAnAttribute
                                                                               multiplier:1.0f
                                                                                 constant:width*26/640];
    
    NSLayoutConstraint *widthConstrainforComment4=[NSLayoutConstraint constraintWithItem:self.Comment4
                                                                               attribute:NSLayoutAttributeWidth
                                                                               relatedBy:NSLayoutRelationEqual
                                                                                  toItem:nil
                                                                               attribute:NSLayoutAttributeNotAnAttribute
                                                                              multiplier:1.0f
                                                                                constant:width*400/640];
    
    topConstrainforComment4.active=YES;
    leftConstrainforComment4.active=YES;
    heightConstrainforComment4.active=YES;
    widthConstrainforComment4.active=YES;
    entity4.frame=self.Comment4.bounds;
    [self.Comment4 addSubview:entity4];
    [entity4 setTitle:@"医疗条件"];
    [entity4 setScore:3.6];


    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)drawRect:(CGRect)rect{
    CGFloat width=[UIScreen mainScreen].bounds.size.width;
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetRGBStrokeColor(context, 215/255.0, 215/255.0, 215/255.0, 1);
    CGContextMoveToPoint(context, width*180/640, width*42/640);
    CGContextAddLineToPoint(context, width*180/640,width*200/640);
    CGContextStrokePath(context);

}



@end
